@extends('backend::common.common_right')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class=" row m-b-sm m-t-sm">
                            <div class="col-md-6">
                                <form method="get" action="{{url('backend/order')}}">
                                    <div class="layui-input-inline">
                                        <label>日期范围</label>
                                        <input type="text" name="date" autocomplete="off" value="{{$date or ''}}" class="layui-input" id="renderdate" placeholder=" - " lay-key="7">
                                    </div>
                                    <span class="checkbox col-md-2 m-r-xs" style="margin: 0px;padding: 0px">
                                        <select class="form-control catsshow" id="seach">
                                            <option value="name">用户名</option>
                                            <option value="mobile">手机号</option>
                                        </select>
                                    </span>
                                    <div class="input-group">
                                        <input type="text" id="seachname" placeholder="搜索内容" name="name"
                                               class="form-control">
                                        <span class="input-group-btn">
                                     <button type="submit" class="btn  btn-primary"> 搜索</button>
                                     </span>
                                    </div>
                                </form>
                                <div class="btn-group">
                                    <a class="btn btn-primary" href="{{url('backend/order')}}"
                                       aria-pressed="true">全部</a>
                                    <a class="btn btn-primary" href="{{url('backend/order')}}?status=1"
                                       aria-pressed="true">已支付</a>
                                    <a class="btn btn-primary active" href="{{url('backend/order')}}?status=0" aria-pressed="true">未支付</a>
                                    <a class="btn btn-primary active" href="{{url('backend/order')}}?type=0" aria-pressed="true">交易币充值</a>
                                    <a class="btn btn-primary active" href="{{url('backend/order')}}?type=1" aria-pressed="true">vip充值</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ibox-content">
                        {{--模态框--}}
                        <div class="">
                            <div class="modal fade" id="myModal" aria-labelledby="myModelLabel" tabindex="-1"
                                 role="dialog" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content animated bounceInRight">

                                    </div>
                                </div>
                            </div>
                        </div>
                        {{--模态框--}}
                        <table class="table table-striped table-bordered table-hover " id="editable">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>订单号</th>
                                <th>充值用户</th>
                                <th>手机号</th>
                                <th>充值类型</th>
                                <th>充值数量</th>
                                <th>支付状态</th>
                                <th>实付金额</th>
                                <th>支付方式</th>
                                <th>充值时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($orders as $order)
                                <tr class="gradeX">
                                    <td>{{$order->id}}</td>
                                    <td>{{$order->order}}</td>
                                    <td><a href="{{url('backend/userinfo',['id'=>$order->user_id])}}"
                                           class="text-navy">{{$order->user->name}}</a></td>
                                    <td>{{$order->user->mobile}}</td>
                                    <td class="center">
                                        @if(!$order->type)
                                            <button class="btn btn-xs btn-primary">交易币</button>
                                        @else
                                            <button class="btn btn-xs btn-warning">VIP</button>
                                        @endif
                                    </td>
                                    <td class="center">
                                        @if(!$order->type)
                                            {{$order->coins}}
                                        @else
                                            {{$order->vip}}
                                        @endif
                                    </td>
                                    <td class="center">
                                        @if($order->status)
                                            <button class="btn btn-xs btn-primary">已支付</button>
                                        @else
                                            <button class="btn btn-xs btn-danger">未支付</button>
                                        @endif
                                    </td>
                                    <td class="center">{{$order->money/100}}</td>
                                    <td class="center">
                                        @if($order->paytype)
                                            微信
                                        @else
                                            支付宝
                                        @endif
                                    </td>
                                    <td class="center">{{$order->created_at}}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                        {{$orders->appends(['status' => isset($status)?$status:'',
                                                'type' => isset($type)?$type:'',
                                                ])->links()}}
                    </div>
                </div>
            </div>
        </div>
        <script>
            $('#seach').change(function () {
                var seachname = $(this).children('option:selected').val()
                $("#seachname").attr('name', seachname);
            })
            var del = function (id, type) {
                layer.confirm('禁用此用户(不可恢复)？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    window.location.href = "{{url('backend/modeldel')}}/" + type + '/' + id;
                }, function () {

                });
            }
        </script>

@endsection

